Skip to content

Fix/type template data#801

Closed
yhaliaw wants to merge 2 commits into
cloudbase:mainfrom
yhaliaw:fix/type-template-data
Closed

Fix/type template data#801
yhaliaw wants to merge 2 commits into
cloudbase:mainfrom
yhaliaw:fix/type-template-data

Conversation

@yhaliaw

@yhaliaw yhaliaw commented Jun 30, 2026

Copy link
Copy Markdown

This PR is intended to fix issue #796.

The byte[] data type for field data in the template causes the OpenAPI spec to record it as an array of uint8, when the returned response is a base64-encoded string.

This PR uses the Base64 type of github.com/go-openapi/strfmt package to ensure the OpenAPI spec generated contains string as the datatype.

I have run make generate on the code.

@yhaliaw yhaliaw marked this pull request as ready for review June 30, 2026 08:38
Comment thread params/requests.go
Name string `json:"name"`
Description string `json:"description"`
Data []byte `json:"data"`
Data strfmt.Base64 `json:"data"`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just add:

// swagger:strfmt byte
Data        []byte              `json:"data"`

and

// go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@v0.33.1 generate spec --output=../swagger.yaml --scan-models --work-dir=../../

will do the right thing.

@gabriel-samfira gabriel-samfira Jun 30, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the annotations in #800. Will probably split that out and merge separately.

@gabriel-samfira

Copy link
Copy Markdown
Member

Added a PR to hopefully fix this:

#802

@yhaliaw

yhaliaw commented Jun 30, 2026

Copy link
Copy Markdown
Author

Closing this since it is covered by another PR.

@yhaliaw yhaliaw closed this Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants